package com.hainabo.mgcmall;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * Created by guoshihao on 2017/11/14.
 */
@Configuration
public class MyMvcConfig extends WebMvcConfigurerAdapter {

    @Value("${file.path}")
    private String path;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry.addResourceHandler("/myres/**").addResourceLocations("file:"+path);
        super.addResourceHandlers(registry);
    }
}